package me.send.business.service.mapper;

import java.util.List;
import java.util.Map;

import me.send.business.base.Page;
import me.send.business.service.BaseMapper;
import me.send.business.service.bean.CompletedBean;
import me.send.business.service.bean.OrderBean;
import me.send.business.service.bean.OrderBrokerBean;
import me.send.business.service.bean.OrderInfoBean;
import me.send.business.service.mapper.provider.BrokerListProvider;
import me.send.business.service.pojo.OrderInfoV1_1Bean;
import me.send.business.service.pojo.OrderInfoV1_1_1Bean;
import me.send.business.service.pojo.Orders;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;

public abstract interface OrdersMapper extends BaseMapper {

	// 主页面 显示 全部的 订单 2015年6月3日16:24:41
	@Select(value = "select orderid,descption,getaddress,sendaddress,tip,userid,status,ordertypeid,voicepath,type from orders where status in (1,2,3,4,5,6,7) order by createtime desc limit #{start},#{size}")
	@Results({
			// 显示编号
			@Result(column = "orderid", property = "orderid"),
			/** 评论的数目 在首页展示 2015年6月12日15:26:47* */
			@Result(column = "orderid", property = "comment_count", one = @One(select = mapper_comment
					+ "count_comment_orderid")),
			@Result(column = "userid", property = "userid"),
			/** 发布的用户 在首先暂时用户的头像和昵称 2015年6月12日15:27:13* */
			@Result(column = "userid", property = "user", one = @One(select = mapper_usermapper
					+ "one_user_userid")),
			/** 点赞的数目 在首页展示 2015年6月12日15:27:35* */
			@Result(column = "userid", property = "zambia_count", one = @One(select = mapper_zambia
					+ "count_userid")),
			@Result(column = "ordertypeid", property = "ordertypeid"),
			/** 首先展示订单的类别 2015年6月12日15:28:07 * */
			@Result(column = "ordertypeid", property = "ordertype", one = @One(select = mapper_ordertype
					+ "one_ordertype_ordertypeid")),
			/** 加载订单的所有的图片 调用其他的接口 mapper 2015年6月10日17:36:34 * */
			@Result(column = "orderid", property = "picpathList", many = @Many(select = mapper_orderpic
					+ "list_orderid")),
			@Result(column = "status", property = "status"),
			/** 订单的状态 是付款状态 还是 在送的状态 在首页展示 2015年6月12日15:28:42* */
			@Result(column = "status", property = "orderstatus", one = @One(select = mapper_orderstatus
					+ "one_orderstatus_orderstatusid")) })
	public abstract List<Map<String, Object>> list_page(Page page);

	/** 上面的方法 不在使用 2015年6月18日11:01:20 **/

	@Select(value = "select orderid,descption,getaddress,sendaddress,tip,userid,status,ordertypeid,voicepath,type,createtime,updatetime,"
			+ "(select count(1) as total from zambia where userid = #{loginuserid} and orderid = t.orderid) as zambiastatus from orders t where t.status in (1,2,3,4,5,6,7) "
			+ " order by t.createtime desc limit #{page.start},#{page.size} ")
	@Results({
			// 显示编号
			@Result(column = "orderid", property = "orderid"),

			@Result(column = "userid", property = "userid"),
			@Result(column = "userid", property = "user", one = @One(select = mapper_usermapper
					+ "one_user_userid")),

			/** 评论的数目 在首页展示 2015年6月12日15:26:47* */
			@Result(column = "orderid", property = "comment_count", one = @One(select = mapper_comment
					+ "count_comment_orderid")),
			@Result(column = "orderid", property = "zambia_count", one = @One(select = mapper_zambia
					+ "count_orderid")),
			@Result(column = "ordertypeid", property = "ordertypeid"),
			@Result(column = "ordertypeid", property = "ordertype", one = @One(select = mapper_ordertype
					+ "one_ordertype_ordertypeid")),
			/** 加载订单的所有的图片 调用其他的接口 mapper 2015年6月10日17:36:34 * */
			@Result(column = "orderid", property = "picpathList", many = @Many(select = mapper_orderpic
					+ "list_orderid")),

			/** * */
			@Result(column = "status", property = "status"),
			@Result(column = "status", property = "orderstatus", one = @One(select = mapper_orderstatus
					+ "one_orderstatus_orderstatusid")) })
	public abstract List<Map<String, Object>> list_page_all(
			Map<String, Object> param);
	
	/**
	 * 首页列表
	 * @param params
	 * @return
	 */
	@Select( value = "SELECT t.orderid,t.descption,t.getaddress,t.sendaddress,t.tip,t.userid,t.`status`,t.ordertypeid,"
			+ "t.voicepath,t.type,t.createtime,t.updatetime,u.headerpath,u.nickname,ot.typename,os.statusname,"
			+ "(SELECT	count(1) AS total FROM `comment` WHERE userid = #{userid} AND orderid = t.orderid) AS commentstatus,"
			+ "(SELECT	count(1) AS total FROM zambia WHERE userid = #{userid} AND orderid = t.orderid) AS zambiastatus,"
			+ "(SELECT count(1) AS total FROM COMMENT WHERE orderid = t.orderid ) comment_count,"
			+ "(SELECT count(1) AS total FROM zambia WHERE orderid = t.orderid ) zambia_count,"
			+ "(SELECT GROUP_CONCAT(picpath) FROM orderpic WHERE orderid = t.orderid ) picpath "
			+ "FROM orders t LEFT JOIN `user` u ON u.userid = t.userid "
			+ "LEFT JOIN ordertype ot ON t.ordertypeid = ot.ordertypeid "
			+ "LEFT JOIN orderstatus os ON os.orderstatusid = t.`status` "
//			+ "WHERE t.STATUS < 8 AND t.isdelete=0 AND IF(#{startid}>0,t.orderid<#{startid},1=1) AND cityname=#{cityname} "
			+ "WHERE t.isdelete=0 AND IF(#{startid}>0,t.orderid<#{startid},1=1) AND cityname=#{cityname} "
			+ "ORDER BY t.orderid DESC LIMIT #{size}")
	@Results({
		@Result(column="zambiastatus",property="zambiastatus"),
		@Result(column="comment_count",property="commentCount"),
		@Result(column="zambia_count",property="zambiaCount")
	})
	public abstract List<OrderBean> indexOrders(Map<String, Object> params);
	
	/**
	 * 用户任务中列表
	 * @param params
	 * @return
	 */
	@Select( value = "SELECT t.orderid,t.descption,t.getaddress,t.sendaddress,t.tip,t.userid,t.`status`,t.ordertypeid,"
			+ "t.voicepath,t.type,t.createtime,t.updatetime,u.headerpath,u.nickname,ot.typename,os.statusname,"
			+ "(SELECT	count(1) AS total FROM `comment` WHERE userid = #{userid} AND orderid = t.orderid) AS commentstatus,"
			+ "(SELECT	count(1) AS total FROM zambia WHERE userid = #{userid} AND orderid = t.orderid) AS zambiastatus,"
			+ "(SELECT count(1) AS total FROM COMMENT WHERE orderid = t.orderid ) comment_count,"
			+ "(SELECT count(1) AS total FROM zambia WHERE orderid = t.orderid ) zambia_count,"
			+ "(SELECT GROUP_CONCAT(picpath) FROM orderpic WHERE orderid = t.orderid ) picpath, "
			+ "(SELECT DISTINCT	p.telephone FROM popuser p LEFT JOIN orderbroker ob ON ob.broker_id = p.popid LEFT JOIN orders o ON o.orderid = ob.order_id WHERE o.orderid = t.orderid AND ob.ischecked = 1 AND o.`status`>2) telephone "
			+ "FROM orders t LEFT JOIN `user` u ON u.userid = t.userid "
			+ "LEFT JOIN ordertype ot ON t.ordertypeid = ot.ordertypeid "
			+ "LEFT JOIN orderstatus os ON os.orderstatusid = t.`status` "
			+ "WHERE t. STATUS < 8 AND t.isdelete=0 AND t.userid = #{userid} "
			+ "AND IF(#{startid}>0,t.orderid<#{startid},1=1) AND cityname=#{cityname} "
			+ "ORDER BY t.orderid DESC LIMIT #{size}")
	@Results({
		@Result(column="zambiastatus",property="zambiastatus"),
		@Result(column="comment_count",property="commentCount"),
		@Result(column="zambia_count",property="zambiaCount")
	})
	public abstract List<OrderBean> tasking(Map<String, Object> params);

	// 主页面 显示 呼送中的 分页数据 2015年6月3日16:24:19
	@Select(value = "select orderid,descption,getaddress,sendaddress,tip,userid,status,ordertypeid,voicepath,type,createtime,updatetime,"
			+ "(select count(1) as total from zambia where userid = #{loginuserid} and orderid = t.orderid) as zambiastatus  from orders t "
			+ " where userid = #{userid} order by createtime desc limit #{page.start},#{page.size}")
//	@Select(value = "select orderid,descption,getaddress,sendaddress,tip,userid,status,ordertypeid,voicepath,type,createtime,updatetime,"
//			+ "(select count(1) as total from zambia where userid = #{loginuserid} and orderid = t.orderid) as zambiastatus  from orders t "
//			+ " where status in (1,2) and userid = #{userid} order by createtime desc limit #{page.start},#{page.size}")
	@Results({
			// 显示编号
			@Result(column = "orderid", property = "orderid"),

			@Result(column = "userid", property = "userid"),
			@Result(column = "userid", property = "user", one = @One(select = mapper_usermapper
					+ "one_user_userid")),

			/** 评论的数目 在首页展示 2015年6月12日15:26:47* */
			@Result(column = "orderid", property = "comment_count", one = @One(select = mapper_comment
					+ "count_comment_orderid")),
			@Result(column = "orderid", property = "zambia_count", one = @One(select = mapper_zambia
					+ "count_orderid")),
			@Result(column = "ordertypeid", property = "ordertypeid"),
			@Result(column = "ordertypeid", property = "ordertype", one = @One(select = mapper_ordertype
					+ "one_ordertype_ordertypeid")),
			/** 加载订单的所有的图片 调用其他的接口 mapper 2015年6月10日17:36:34 * */
			@Result(column = "orderid", property = "picpathList", many = @Many(select = mapper_orderpic
					+ "list_orderid")),

			/** * */
			@Result(column = "status", property = "status"),
			@Result(column = "status", property = "orderstatus", one = @One(select = mapper_orderstatus
					+ "one_orderstatus_orderstatusid")) })
	public abstract List<Map<String, Object>> list_page2(
			Map<String, Object> param);

	// 显示个人中心的 呼送记录 分页显示 2015年6月3日16:24:58
	@Select(value = "select orderid,descption,getaddress,sendaddress,tip,userid,status,ordertypeid,voicepath,type,createtime,updatetime, "
			+ "(select count(1) as total from zambia where userid = #{loginuserid} and orderid = t.orderid) as zambiastatus from orders t"
			+ " where status = 7 and userid = #{userid} order by createtime desc limit #{page.start},#{page.size}")
	@Results({
			// 显示编号
			@Result(column = "orderid", property = "orderid"),

			@Result(column = "userid", property = "userid"),
			@Result(column = "userid", property = "user", one = @One(select = mapper_usermapper
					+ "one_user_userid")),

			/** 评论的数目 在首页展示 2015年6月12日15:26:47* */
			@Result(column = "orderid", property = "comment_count", one = @One(select = mapper_comment
					+ "count_comment_orderid")),
			@Result(column = "orderid", property = "zambia_count", one = @One(select = mapper_zambia
					+ "count_orderid")),
			@Result(column = "ordertypeid", property = "ordertypeid"),
			@Result(column = "ordertypeid", property = "ordertype", one = @One(select = mapper_ordertype
					+ "one_ordertype_ordertypeid")),
			/** 加载订单的所有的图片 调用其他的接口 mapper 2015年6月10日17:36:34 * */
			@Result(column = "orderid", property = "picpathList", many = @Many(select = mapper_orderpic
					+ "list_orderid")),

			/** * */
			@Result(column = "status", property = "status"),
			@Result(column = "status", property = "orderstatus", one = @One(select = mapper_orderstatus
					+ "one_orderstatus_orderstatusid")) })
	public abstract List<Map<String, Object>> list_page_userid(
			Map<String, Object> param);
	
	

	// 增加小费
	@Update(value = "update orders set tip = tip+#{tip},updatetime = #{updatetime} where orderid = #{orderid} ")
	public abstract int update_tip_orderid(Orders orders);
	
	@Update(value = "update orders set tip = tip+#{tip},updatetime = #{updatetime} where orderid = #{orderid} AND userid=#{userid}")
	public abstract int addTip(Map<String, Object> param);

	// 取消订单
	@Delete(value = "delete from order where orderid = #{orderid}")
	public abstract void delete_orders_orderid(int orderid);
	
	/**
	 * 取消订单
	 * @param orderid
	 * @return
	 */
	@Update(value = "UPDATE orders o SET o.isdelete=1 WHERE o.orderid = #{orderid} AND o.userid=#{userid}")
	public abstract int deleteOrder(Map<String, Object> param);
	
	/**
	 * 申请取消订单
	 * @param orderid
	 * @return
	 */
	@Update(value = "UPDATE orders o SET o.need_cancel=1 WHERE o.orderid = #{orderid} AND o.userid=#{userid}")
	public abstract int needCancelOrder(Map<String, Object> param);

	// 根据主键查询出来一个订单
	@Select(value = "select o.orderid,o.fee,o.tip,o.discount from orders o where o.orderid = #{orderid}")
	public abstract Map<String, Object> one_map_orderid(int orderid);
	
	/**
     * 获取订单详情
     * @param order
     * @return
     */
    @Select(value = "SELECT o.orderid orderid,o.createtime,o.voicepath,o.type,(o.fee+discount) fee,o.tip,o.`status`,o.ordertypeid,"
    		+ "`user`.nickname,`user`.telephone utel,`user`.headerpath uheader,"//添加 nickname utel uheader三个字段 2015.9.29
    		+ "p.username,p.telephone,p.headerpath,p.popid,o.address,o.descption,o.ordertypeid,o.type,cd.text fromAddress,"
    		+ "cd1.text toAddress,cd.`name` fromName,"
    		+ "cd1.`name` toName, cd.telephone fromTelephone,cd1.telephone toTelephone,group_concat(op.picpath) picpath "
    		+ "FROM orders o LEFT JOIN orderpic op ON op.orderid = o.orderid LEFT JOIN `user` ON `user`.userid = o.userid "
    		+ "LEFT JOIN commaddress cd ON cd.addressid = o.address_id LEFT JOIN commaddress cd1 ON cd1.addressid = o.to_address_id "
    		+ "LEFT JOIN orderbroker ob ON ob.order_id = o.orderid LEFT JOIN popuser p ON p.popid = ob.broker_id "
    		+ "WHERE o.orderid = #{orderid} AND IF(o.`status`>2,ob.ischecked=1,1=1) LIMIT 0,1")
    public abstract OrderInfoBean getOrder(int orderid);
    
    @Select(value="SELECT longitude lng,latitude lat FROM orders o WHERE o.orderid=#{orderid}")
    public abstract Map<String, String> getOrderLocation(int orderid);
    
    /**
     * 获取订单详情
     * @param order
     * @return
     */
    @Select(value = "SELECT o.need_cancel needCancel,o.orderid orderid,o.createtime,o.voicepath,o.type,(o.fee+discount) fee,o.tip,o.`status`,o.ordertypeid,"
    		+ "`user`.nickname,`user`.telephone utel,`user`.headerpath uheader,"//添加 nickname utel uheader三个字段 2015.9.29
    		+ "p.username,p.telephone,p.headerpath,p.popid,o.address,o.descption,o.ordertypeid,o.type,cd.text fromAddress"
    		+ "cd1.text toAddress,cd.`name` fromName,"
    		+ "cd1.`name` toName, cd.telephone fromTelephone,cd1.telephone toTelephone,group_concat(op.picpath) picpath "
    		+ "FROM orders o LEFT JOIN orderpic op ON op.orderid = o.orderid LEFT JOIN `user` ON `user`.userid = o.userid "
    		+ "LEFT JOIN commaddress cd ON cd.addressid = o.address_id LEFT JOIN commaddress cd1 ON cd1.addressid = o.to_address_id "
    		+ "LEFT JOIN orderbroker ob ON ob.order_id = o.orderid LEFT JOIN popuser p ON p.popid = ob.broker_id "
    		+ "WHERE o.orderid = #{orderid} AND IF(o.`status`>2,ob.ischecked=1,1=1) LIMIT 0,1")
    public abstract OrderInfoV1_1Bean getOrderForV1_1(int orderid);
    
    /**
     * 获取订单详情
     * @param order
     * @return
     */
    @Select(value = "SELECT o.need_cancel needCancel,o.orderid orderid,o.createtime,o.voicepath,o.type,(o.fee+discount) fee,o.tip,o.`status`,o.ordertypeid,"
    		+ "`user`.nickname,`user`.telephone utel,`user`.headerpath uheader,"//添加 nickname utel uheader三个字段 2015.9.29
    		+ "p.username,p.telephone,p.headerpath,p.popid,o.address,o.descption,o.ordertypeid,o.type,cd.text fromAddress,discount,"
    		+ "cd1.text toAddress,cd.`name` fromName,"
    		+ "cd1.`name` toName, cd.telephone fromTelephone,cd1.telephone toTelephone,group_concat(op.picpath) picpath,"
    		+ "(SELECT r.money FROM red r LEFT JOIN userred ur ON r.redid = ur.redid WHERE ur.orderid = #{orderid} ) red "
    		+ "FROM orders o LEFT JOIN orderpic op ON op.orderid = o.orderid "
    		+ "LEFT JOIN `user` ON `user`.userid = o.userid "
    		+ "LEFT JOIN commaddress cd ON cd.addressid = o.address_id LEFT JOIN commaddress cd1 ON cd1.addressid = o.to_address_id "
    		+ "LEFT JOIN orderbroker ob ON ob.order_id = o.orderid"
    		+ " LEFT JOIN popuser p ON p.popid = ob.broker_id "
    		+ "WHERE o.orderid = #{orderid} AND IF(o.`status`>2,ob.ischecked=1,1=1) LIMIT 0,1")
    public abstract OrderInfoV1_1_1Bean getOrderForV1_1_1(int orderid);
    
    
	// 查看是否订单在 2015年6月4日14:42:44
	@Select(value = "select count(1) as total from orders where orderid = #{orderid} ")
	public abstract int count_orderid(int orderid);

	// 在使用one的时候 指定在内存中的sql或者是指定这个mapper下面sql的key值 2015年6月3日15:12:52

	// 增加订单
	/**
	 * getaddress 取货地址 tip 小费 sendaddress 送货地址 userid 发布用户 status 状态 ordertypeid
	 * 订单类型 tradtime 交易时间 capital 本钱 address 发送地址 longitude 经度 latitude 维度
	 * 
	 * 2015年6月2日11:26:47
	 */
	@Insert(value = "insert into orders(orderid,descption,createtime,getaddress,tip,sendaddress,userid,status,ordertypeid,tradtime,capital,"
			+ "address,longitude,latitude,voicepath,type,address_id,to_address_id,cityid,cityname,fee,discount,advert_id)"
			+ " values(#{orderid},#{descption},#{createtime},#{getaddress},#{tip},#{sendaddress},#{userid},"
			+ "#{status},#{ordertypeid},#{tradtime},#{capital},#{address},#{longitude},#{latitude},#{voicepath},#{type},"
			+ "#{addressId},#{toAddressId},#{cityid},#{cityname},#{fee},#{discount},#{advertId})")
	@Options(keyProperty="orderid",useGeneratedKeys=true)
	public abstract void release_userid(Orders orders);

	/**
	 * 查询订单最大值的编号 id 2015年6月10日16:58:48
	 */
	@Select(value = "select case when max(orderid) is null then 1 else max(orderid) +1 end  max_orderid from orders")
	public abstract int max_id();

	// 更新已完成的 用户订单的 2015年7月20日11:23:38 提供给个人中心使用
	@Select(value = "select count(1) as total from orders where userid = #{userid} and status = 7")
	public abstract int user_order_count_status(Integer userid);

	// 查询出这个用户的累积小费 2015年7月20日11:29:13 提供给个人中心使用
	@Select(value = "select sum(tip) as tips from orders where userid = #{userid} and status = 7")
	public abstract int user_order_tip_status(Integer userid);

	/**
	 * 获取已经纪人已抢单的订单列表
	 * 
	 * @param orderid
	 * @return
	 */
//	@Select(value = "SELECT ob.order_broker_id,ob.broker_id,ob.order_id,ob.ischecked,ob.latitude,ob.longitude,broker.username,"
//			+ "(SELECT DISTINCT SUM(be.point)/COUNT(be.point) FROM broker_evaluate be "
//			+ "LEFT JOIN orders o ON be.orderid = o.orderid "
//			+ "LEFT JOIN orderbroker odb ON odb.order_id = o.orderid "
//			+ "WHERE odb.broker_id=ob.broker_id) stars,"
//			+ "broker.`level`,"
//			+ "(SELECT COUNT(1) FROM orderbroker obr WHERE obr.broker_id = ob.broker_id AND obr.ischecked = 1 ) as orders,"
//			+ "broker.headerpath FROM orderbroker ob "
//			+ "LEFT JOIN popuser broker ON ob.broker_id = broker.popid "
//			+ "WHERE order_id=#{orderid}")
	@SelectProvider(method="getBrokerList",type=BrokerListProvider.class)
	@Results({ @Result(column = "order_broker_id", property = "orderBrokerId"),
			@Result(column = "broker_id", property = "brokerId"),
			@Result(column = "order_id", property = "orderId"),
			@Result(column = "ischecked", property = "isChecked"),
			@Result(column = "latitude", property = "latitude"),
			@Result(column = "longitude", property = "longitude"),
			@Result(column = "headerpath", property = "headerpic"),
			@Result(column = "level", property = "level"),
			@Result(column = "username", property = "username"),
			@Result(column = "orders", property = "orders") })
	public abstract List<OrderBrokerBean> order_broker_list(Map<String, Object> params);
	
	
	/**
	 * 获取已完成列表
	 * @param params
	 * @return
	 * @author maxmin
	 * @date 2015年8月31日上午11:41:38
	 */
	@Select(value = "SELECT o.ordertypeid,o.`status`,o.voicepath,o.sendaddress,o.descption,o.getaddress,p.popid brokerid,"
    		+ "o.fee,o.type,o.tip,o.orderid,o.createtime,u.telephone "
		    + "FROM orders o LEFT JOIN `user` u ON o.userid = u.userid LEFT JOIN orderbroker ob ON o.orderid = ob.order_id "
		    + "LEFT JOIN popuser p ON p.popid = ob.broker_id "
		    + "WHERE IF (#{startid}= 0, 1 = 1, o.orderid <#{startid}) AND o.`status` >= 8 AND o.isdelete=0 AND ob.ischecked=1 "
		    + "AND u.userid = #{userid} ORDER BY o.orderid DESC LIMIT #{size}")
	public abstract List<CompletedBean> completedOrders(Map<String, Object> params);
	
	/**
	 * 修改订单状态为已确认完成
	 * @param params
	 * @return
	 */
	@Update(value = "UPDATE orders SET status = 7 WHERE orderid=#{orderid} AND status>3 AND status<7")
    public abstract int updateStatus(int orderid);
	
	@Select(value = "SELECT p.isvAccountId FROM popuser p LEFT JOIN orderbroker ob ON p.popid = ob.broker_id WHERE order_id =#{orderid} AND ischecked = 1")
	public abstract String getBrokerIsvAccountByOrderId(int orderid);
	
	
	@Select (value = "SELECT COUNT(1) from popuser WHERE cityname=#{cityname}")
	public abstract int broker_count(String cityname);
	
	@Select(value = "SELECT p.popid FROM popuser p LEFT JOIN orderbroker ob ON p.popid = ob.broker_id WHERE order_id =#{orderid} AND ischecked = 1")
	public abstract int getBrokerIdByOrderId(int orderid);
	
	/**
     * 获取订单详情
     * @param order
     * @return
     */
//    @Select(value = "SELECT o.orderid orderid,o.createtime,o.voicepath,o.type,o.fee,o.tip,o.`status`,o.ordertypeid,"
//    		+ "`user`.nickname username,`user`.telephone,o.address,o.descption,o.ordertypeid,"
//    		+ "o.type,cd.text fromAddress,cd1.text toAddress,cd.`name` fromName,"
//		    + "cd1.`name` toName, cd.telephone fromTelephone,cd1.telephone toTelephone,group_concat(op.picpath) picpath "
//		    + "FROM orders o LEFT JOIN orderpic op ON op.orderid = o.orderid LEFT JOIN `user` ON `user`.userid = o.userid "
//		    + "LEFT JOIN commaddress cd ON cd.addressid = o.address_id LEFT JOIN commaddress cd1 "
//		    + "ON cd1.addressid = o.to_address_id WHERE o.orderid = #{orderid} LIMIT 0,1")
//    public abstract OrdersInfoBean getOrderInfo(int orderid);
    
    @Update(value="UPDATE orders set `status` = 9 WHERE orderid=#{orderid}")
    public abstract int completEvaluate(int orderid);
}
